package a.jframe;

import generator.Generator;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;

import javax.swing.JCheckBox;

import Files.File_;
import Files._FILE_;
import a.SwingShell;

public class ActionListenerPanel implements ActionListener {

	private String labname_;

	public ActionListenerPanel(String labname) {
		labname_ = labname;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		Generator.Generuj(e.getSource(), labname_);
		System.out.println(e.getSource());
		if (labname_ == "openinternalwindow") {
			//new LabCredentials();
		}
		if (labname_ == "addNewLab") {
			new LabCredentials();
		}
		if (labname_ == "saveNewLab") {
			System.out.println("tu");
			new File_().addToMap(Lab.fieldWithCommandName.getText(),
					Lab.fieldWithSyntaxOfCommand.getText(), 1);
			BASEFRAME.c(1);
		}

		if (labname_ == "savenewcommand") {
			System.out.println("tu");
			new File_().addToMap(Lab.fieldWithCommandName.getText(),
					Lab.fieldWithSyntaxOfCommand.getText(), 0);
			BASEFRAME.c(0);
		}
		/*
		 * System.out.println(
		 * SwingShell.arraycomandpanel.get(labname_).setcommand(
		 * (((JCheckBox)e.getSource()).isSelected())?"tak":"nie")));
		 */

	}

}
